package com.richard.library.bluetooth.dto;

import android.bluetooth.BluetoothDevice;
import android.text.TextUtils;

import java.io.Serializable;

/**
 * <pre>
 * Description : 蓝牙设备
 * Author : Richard
 * Date : 2023/4/16 08:29
 * Changelog: 无
 * </pre>
 */
public class BleDevice implements Serializable {

    /**蓝牙设备*/
    private BluetoothDevice device;

    /**信号值*/
    private Integer rssi;

    public BleDevice(BluetoothDevice device) {
        this.device = device;
    }

    public BleDevice(BluetoothDevice device, Integer rssi) {
        this.device = device;
        this.rssi = rssi;
    }

    public String getShowName(){
        String name = this.device.getAlias();
        if(TextUtils.isEmpty(name)){
            name = this.device.getName();
        }
        if(TextUtils.isEmpty(name)){
            name = "Unknown";
        }

        return name;
    }

    public BluetoothDevice getDevice() {
        return device;
    }

    public void setDevice(BluetoothDevice device) {
        this.device = device;
    }

    public Integer getRssi() {
        return rssi;
    }

    public void setRssi(Integer rssi) {
        this.rssi = rssi;
    }
}
